package com.chenglin.dogapplication

import android.util.Log
import androidx.recyclerview.widget.DiffUtil

/**
 *
 * @Author:         程林
 * @CreateDate:     2021/9/24$ 15:42$
 */
class DiffUtilCallBack(var oldList : List<KeyValueBean>,var newList : List<KeyValueBean>) : DiffUtil.Callback() {
    override fun getOldListSize(): Int {
        return oldList.size
    }

    override fun getNewListSize(): Int {
        return newList.size
    }

    override fun areItemsTheSame(oldItemPosition: Int, newItemPosition: Int): Boolean {
        if (oldList[oldItemPosition].id != newList[newItemPosition].id){
            Log.e("areItemsTheSame","false")
            return false
        }
       return true
    }

    override fun areContentsTheSame(oldItemPosition: Int, newItemPosition: Int): Boolean {
        if (oldList[oldItemPosition].name !=  newList[newItemPosition].name){
            return  false
        }

        return  true


    }


}